package com.atguigu01.collection;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Collection;

/**
 * ClassName: CollectionTest
 * Package: com.atguigu01.collection
 * Description:
 *  测试Collection中的方法的使用
 * @Author ZY
 * @Create 14:03
 * @Version 1.0
 */
public class CollectionTest {
    @Test
    public void test1(){
        Collection coll = new ArrayList();

        //add()
        coll.add("AA");
        coll.add(123);//自动装箱
        coll.add("尚硅谷");
        coll.add(new Object());
        coll.add(new Person("Tom",12));

        System.out.println(coll);
        System.out.println(coll.size());//5

        //addAll()
        Collection coll1 = new ArrayList();
        coll1.add("80");
        coll1.add(456);

        coll1.addAll( coll);
//        coll.addAll( coll1);
        System.out.println(coll1);

        //size()
        System.out.println(coll1.size());//7
    }


}
